<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.


if(isset($_GET['lang'])) {
	if($_GET['lang'] == 'en') {
		setcookie('lang', 'en', 0, '/');
		$_COOKIE['lang'] = 'en';
	} else if($_GET['lang'] == 'cn')  {
		setcookie('lang', 'cn', 0, '/');
	}
}

$lang = 'zh_cn';
if(isset($_COOKIE['lang']) && $_COOKIE['lang'] == 'en') {
	$lang = 'en';
}
return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'奥特梅尔光电科技',

    'language' => $lang,
	// preloading 'log' component
	'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',
	),

	'modules'=>array(
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'111222',
		 	// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
		),
		'admin',
	),

	// application components
	'components'=>array(
		'user'=>array(
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
		),
		// uncomment the following to enable URLs in path-format
		'urlManager'=>array(
			'urlFormat'=>'path',
			'rules'=>array(
				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
			),
			'showScriptName' => true
		),
		'db'=>array(
			'connectionString' => 'mysql:host=localhost;dbname=automv',
			'emulatePrepare' => true,
			'username' => 'automv_f',
			'password' => '111222',
			'charset' => 'utf8',
		),
		'errorHandler'=>array(
			// use 'site/error' action to display errors
            'errorAction'=>'site/error',
        ),
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
// 				array(
// 					'class'=>'CWebLogRoute',
// 				),
			),
		),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'webmaster@example.com',
		'tags'=>array(
			'tech' => '技术支持',
			'news' => '公司新闻',
			'faq'  => '常见问题',
        ),
        'types'=>array(
            'automat'=>'光电自准直仪',
            'ld'=>'线扫描数字相机',
            'lvpci'=>'高速PCI数据采集卡',
            'ls'=>'线扫描光源',
            'jingtou'=>'镜头产品'
        )
	),
);
